<?php

namespace App\Modules\CodeDesigner\Strategy;

use App\Modules\CodeDesigner\Strategy\Mode\StrategyA;
use App\Modules\CodeDesigner\Strategy\Mode\StrategyB;
use App\Modules\CodeDesigner\Strategy\Mode\StrategyC;

class CashContextFactory
{

    protected $mode;

    public function __construct(string $type)
    {
        switch ($type) {
            case 'A' :
                $this->mode = new StrategyA();
                break;
            case 'B' :
                $this->mode = new StrategyB(0.8);
                break;
            case 'C':
                $this->mode = new StrategyC(100, 20);
            default :
                break;
        }
    }

    public function getResult(float $money): float
    {
        return $this->mode->getResult($money);
    }
}